package com.dale.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dale.common.dto.BlogDto;
import com.dale.entity.Blog;
import com.dale.mapper.BlogMapper;
import com.dale.service.BlogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author  ：MarkerHub
 * @since 2020-05-25
 */
@Service
public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements BlogService {
    @Autowired
    BlogMapper blogMapper;

    @Override
    public Long getMaxId() {
        return blogMapper.getMaxId();
    }

    @Override
    public IPage<BlogDto> selectAllBlogs(Page<BlogDto> page) {
        return blogMapper.selectAllBlogs(page);
    }

    @Override
    public BlogDto getBlogDtoById(Long id) {
        return blogMapper.getBlogDtoById(id);
    }

    @Override
    public List<BlogDto> getMostLikeTodayBlog() {
        return blogMapper.getMostLikeTodayBlog();
    }

    @Override
    public IPage<BlogDto> searchBlog(Page<BlogDto> page, String searchContent) {
        return blogMapper.searchBlog(page,searchContent);
    }

}
